package com.transaction.manage.localMapper;

import com.transaction.manage.model.dto.AccountStatus;
import com.transaction.manage.myMapper.MyMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.LinkedHashMap;

public interface AccountStatusMapper extends MyMapper<AccountStatus> {

    @Update("UPDATE account_status SET STATUS = #{status} WHERE channel_Code = #{channelCode} AND transaction_Account_Id = #{transactionAccountId} ")
    void updateStatusByChannelCodeAndTransactionAccountId(@Param("channelCode") String channelCode,
                                                                @Param("transactionAccountId") String transactionAccountId,
                                                                @Param("status") int status);

    @Update("UPDATE account_status SET individual_Or_Institution = #{account.INDIVIDUALORINSTITUTION}, certificate_Type = #{account.CERTIFICATETYPE}, " +
            "certificate_No = #{account.CERTIFICATENO}, investor_Name = #{account.INVESTORNAME} " +
            "WHERE channel_Code = #{channelCode} AND transaction_Account_Id = #{transactionAccountId} ")
    void update4ElementByChannelCodeAndTransactionAccountId(@Param("channelCode") String channelCode,
                                                            @Param("handleDate") String handleDate,
                                                            @Param("account") LinkedHashMap<String, Object> account);

    AccountStatus selectAccountByChannelAndTransactionAccountId(@Param("channelCode") String channelCode,
                                                                @Param("transactionAccountId") String transactionAccountId);
}
